using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.ObjectModel;
using System.ComponentModel;

namespace LocalizeMe
{
    public abstract class ResourceSource
    {

        private Dictionary<string,ResourceItemCollection> _items;
        protected string _name=string.Empty;
        

        [Browsable(false)]
        protected Dictionary<string, ResourceItemCollection> Items
        {
            get
            {
                if (_items == null)
                    _items = new Dictionary<string, ResourceItemCollection>();
                return _items;
            }
        }

        public string Name
        {
            get
            {
                return _name;
            }
            set
            {
                _name = value;
            }
        }

        

        public virtual ResourceItemCollection GetValues(string culture)
        {
            try
            {
                if (this.Items.ContainsKey(culture))
                    return this.Items[culture];
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
            
            return null;
        }

        public abstract void Load();
        public abstract void Save();
        public abstract Collection<string> GetAvailableCultures();

        

    }
}
